package com.spider.demo;

public class GoldCard extends  Card{
    public GoldCard(String number, String name, String phone, double balance) {
        super(number, name, phone, balance);
    }

    @Override
    public void payMoney(double money) {
        System.out.println("您当前消费："+ money);
        System.out.println("优惠后的价格为："+ money * 0.8);
        if (money * 0.8>=getBalance()){
            System.out.println("您的余额不足，请充值！🙂");
            return;//退出方法
        }
        //更新后的账户余额
        setBalance(getBalance()-money*0.8);
        //判断消费金额是否大于200,如果是则打印洗车票
        if (money * 0.8>200){
            printWashCarTicket();
        }
        else {
            System.out.println("您本次没有消费200"+"没洗车票~");
        }
    }
    //打印洗车票
    public void printWashCarTicket(){
        System.out.println("您本次消费了"+"请打印洗车票");
    }
}
